package model

import (
	"time"

	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	Name          string `form:"name" json:"name"`
	Password      string `form:"password" json:"password"`
	Phone         string
	Email         string `valid:"email"`                                             // 邮箱校验
	Identity      string `gorm:"column:idenity" valid:"matchers(^1[3-9]{1}\\d{9}$)"` // 手机号校验
	ClientIp      string
	ClientPort    string
	LoginTime     time.Time `gorm:"column:login_time" json:"login_time"`
	HeartbeatTime time.Time `gorm:"column:heartbeat_time" json:"heartbeat_time"`
	LogoutTime    time.Time `gorm:"column:logout_time" json:"logout_time"`
	Islogout      bool
	DeviceInfo    string
	Salt          string
}

func (tabe *User) TableName() string {
	return "user_basic"
}
